<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #app{
            margin: 200px auto;
            height: 300px;
            width: 300px;
        }
        .btn {
            display: flex;
            
        }
        .btn div {
            width: 80px;
            height: 30px;
            background-color: #ccc;
            text-align: center;
            line-height: 30px;
            margin-right: 5px;
        }
        .btn .active {
            background-color: blue;
        }
        .content div {
            width: 300px;
            height: 200px;
            background-color: red;
            display: none;
        }

        .content .view{
            display: block;
        }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <div class="btn">
            <div class="btn1" :class="num===1? 'active':''" @click="num=1">按钮1</div>
            <div class="btn2" :class="num===2? 'active':''" @click="num=2">按钮2</div>
            <div class="btn3" :class="num===3? 'active':''" @click="num=3">按钮3</div>
        </div>
        <div class="content">
            <div class="content1" :class="num===1? 'view':''">按钮1的内容</div>
            <div class="content2" :class="num===2? 'view':''">按钮2的内容</div>
            <div class="content3" :class="num===3? 'view':''">按钮3的内容</div>
        </div>
    </div>
    <script>
         new Vue({
            el:'#app', //指定绑定的盒子，这个盒子的数据都由这个Vue管理
            data:{
                num:1
            }
        })
    </script>
</body>
</html>